//
//  NSIOApiManager.m
//  Meboo
//
//  Created by kyo on 2024/5/24.
//

#import "NSIOApiManager.h"
#import "MBHTTPNetworking.h"
@implementation NSIOApiManager
+ (NSIOApiManager *)sharedManager {
    static dispatch_once_t onceToken;
    static NSIOApiManager *obj;
    dispatch_once(&onceToken, ^{
        obj = [[self alloc] init];
    });
    return obj;
}

//埋点 类型1 传eventName
- (void)setIOWithEventName:(NSString *)eventName {
    if (eventName.length == 0) {
        eventName = @"";
    }
    NSMutableDictionary *params = [[NSMutableDictionary alloc] init];
    [params setObject:eventName forKey:@"eventName"];
    [[MBHTTPNetworking sharedInstance] WSAFNoOAuthUrlString:@"api/common/receive/common/notify" method:@"POST" parameters:params success:^(id  _Nullable responseObject) {
        NSLog(@"");
    } failure:^(NSError * _Nullable error) {
        NSLog(@"");
    }];
}

//埋点 类型2 传code和content
- (void)setIOWithCode:(NSString *)code content:(NSString *)content {
    if (code.length == 0) {
        code = @"";
    }
    if (content.length == 0) {
        content = @"";
    }
    NSMutableDictionary *params = [[NSMutableDictionary alloc] init];
    [params setObject:code forKey:@"code"];
    [params setObject:content forKey:@"content"];
    [params setObject:[MBUserAccount defaultAccount].chatUserId ?: @"" forKey:@"userCode"];
    [[MBHTTPNetworking sharedInstance] WSAFNoOAuthUrlString:@"api/common/receive/common/notify" method:@"POST" parameters:params success:^(id  _Nullable responseObject) {
        NSLog(@"");
    } failure:^(NSError * _Nullable error) {
        NSLog(@"");
    }];
}
@end
